<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

if (!function_exists('check_sessionEmailId')) {

    function check_sessionEmailId($data) {
        if ($data != NULL) {
            $CI = & get_instance();
            $CI->db->where('sessionKey', $data['sessionKey']);
            $query = $CI->db->get('tbl_user_session');
            if ($query->num_rows == 1) {
                if ($data['emailAddress'] != '' || $data['emailAddress'] != NULL) {
                    $CI->db->where('emailAddress', $data['emailAddress']);
                    $emailquery = $CI->db->get('tbl_user_session');
                    if ($emailquery->num_rows == 1) {
                        $CI->db->where($data);
                        ///  $CI->db->where('emailAddress', $data['emailAddress']);
                        $getrowquery = $CI->db->get('tbl_user_session');
                        if ($getrowquery->num_rows == 1) {
                            return 1;
                        }
                        else
                            return - 2;
                    } else
                        return -1;
                }
            } else {
                return 0;
            }
        }
    }

}